import $ from '../common';
Page({
  data: {

  },
  onLoad(e) {
    const{key='',tit='',value='',student_uuid='',campus_uuid='',type,inputtype,url}=JSON.parse(e.info)
    this.setData({
      key,
      tit,
      value,student_uuid,campus_uuid,
      zonecode: wx.getStorageSync('addresscode') || '',
      type,
      inputtype,
      url
    })
    wx.setNavigationBarTitle({
      title:tit,
    })
  },
  onShow() {

  },
  inputchange(e){
    this.setData({
      [this.data.key]:e.detail.value
    })
  },
  save(){
    const {key,student_uuid,campus_uuid,url}=this.data
    $.post(url,{
      [key]:this.data[key],
      student_uuid,
      campus_uuid,
    },res=>{
      $.parent().getinfo()
      $.navigateBack()
    })
  }
})